﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Data;
using DTO;
using DAO;
namespace Banking.Member
{
    public partial class ThongTinTaiKhoanCaNhan : UserControl
    {
        TypeDemo type;
        public ThongTinTaiKhoanCaNhan()
        {
            InitializeComponent();
        }

        public void Load(int ma,TypeDemo typedemo)
        {
            type = typedemo;
            dgvTaiKhoanThe.DataSource = TaiKhoanTheDA.GetByMaTaiKhoanChinh(ma,type.typeDemo);
            dgvTaiKhoanThe.Columns["MaLoaiThe"].Visible = false;

            dgvTaiKhoanThe.Columns["MaLoaiTien"].Visible = false;

            dgvTaiKhoanThe.Columns["MaLoaiTK"].Visible = false;
            dgvTaiKhoanThe.Columns["LoaiCard"].Visible = false;
            dgvTaiKhoanThe.Columns["TaiKhoanChinh"].Visible = false;
            dgvTaiKhoanThe.Columns["LoaiMoney"].Visible = false;
            dgvTaiKhoanThe.Columns["LoaiTK"].Visible = false;
            dgvTaiKhoanThe.Columns["DelFlg"].Visible = false;
            dgvTaiKhoanThe.Columns["LockFlg"].Visible = false;
            dgvTaiKhoanThe.Columns["SoDu"].DefaultCellStyle.Format = "0";
        }

        private void buttonX2_Click(object sender, EventArgs e)
        {
            if (dgvTaiKhoanThe.SelectedRows.Count == 1)
            {
                int maTKT = int.Parse(dgvTaiKhoanThe.SelectedRows[0].Cells["MaTaiKhoanThe"].Value.ToString());
                ChiTietGiaoDich frm = new ChiTietGiaoDich(maTKT,type);
                frm.ShowDialog();
            }
        }

        private void btnRutTien_Click(object sender, EventArgs e)
        {
            if (dgvTaiKhoanThe.SelectedRows.Count == 1)
            {
                int maTKT = int.Parse(dgvTaiKhoanThe.SelectedRows[0].Cells["MaTaiKhoanThe"].Value.ToString());
                Nhân_viên.frmRutTien frm = new Nhân_viên.frmRutTien(maTKT, type);
                frm.ShowDialog();
            }
        }

        private void btnChuyenTien_Click(object sender, EventArgs e)
        {
            if (dgvTaiKhoanThe.SelectedRows.Count == 1)
            {
                int maTKT = int.Parse(dgvTaiKhoanThe.SelectedRows[0].Cells["MaTaiKhoanThe"].Value.ToString());
                frmChuyenKhoan frm = new frmChuyenKhoan(maTKT,type);
                frm.ShowDialog();
            }

        }

     
    }
}
